/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    height: 100vh;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部状态栏 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.header-left h1 {
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.status-indicator.offline {
    background-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
}

.status-indicator.online {
    background-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.3);
}

.status-indicator.connecting {
    background-color: #f39c12;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.3);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.header-right {
    display: flex;
    gap: 1rem;
}

/* 按钮样式 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 设备列表 */
.device-list {
    background: rgba(255, 255, 255, 0.95);
    margin: 1rem 2rem;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.device-list h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.devices {
    display: grid;
    gap: 1rem;
}

.device-item {
    background: rgba(255, 255, 255, 0.7);
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-item:hover {
    border-color: #3498db;
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.device-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.device-name {
    font-weight: 600;
    color: #2c3e50;
}

.device-id {
    font-size: 0.8rem;
    color: #666;
}

.device-rssi {
    background: #ecf0f1;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #7f8c8d;
}

/* 主控制区域 */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.control-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.control-panel h3 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ecf0f1;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    color: #555;
    font-weight: 500;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.button-group {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.mode-grid,
.technique-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
}

.mode-btn,
.technique-btn,
.time-btn {
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #495057;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.mode-btn:hover,
.technique-btn:hover,
.time-btn:hover {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-color: #2980b9;
}

.mode-btn.active,
.technique-btn.active,
.time-btn.active {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
    border-color: #229954;
}

/* 滑块控制 */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.slider-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: #2c3e50;
    background: #ecf0f1;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
}

/* 开关控制 */
.switch-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
}

.switch input {
    display: none;
}

.switch-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    transition: 0.3s;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch-slider {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(26px);
}

.switch-label {
    font-weight: 500;
    color: #555;
}

/* 健康数据显示 */
.health-data {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.health-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.health-label {
    font-weight: 500;
    color: #2c3e50;
}

.health-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #3498db;
}

.health-unit {
    font-size: 0.9rem;
    color: #666;
}

.time-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
}

/* 状态面板 */
.status-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.status-panel h3 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ecf0f1;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(236, 240, 241, 0.5);
    border-radius: 8px;
    border-left: 4px solid #95a5a6;
}

.status-label {
    font-weight: 500;
    color: #2c3e50;
}

.status-value {
    font-weight: 600;
    color: #27ae60;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

    .main-content {
        padding: 1rem;
    }

    .control-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .button-group {
        justify-content: center;
    }

    .time-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .status-grid {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.control-panel,
.status-panel {
    animation: fadeIn 0.6s ease-out;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}